﻿@page "/Admin"
@using Markdig
@attribute [TabItemOption(Text = "主页", Closable = false)]

<PageTitle>主页</PageTitle>

<link href="https://easyadmim.wang-zhan.com.cn/css/doc.css" rel="stylesheet" />

<div class="row">
    <div class="col-6">
        
    </div>
    <div class="col-6">
        <Card>
            <BodyTemplate>
                <Scroll Height="600px" class="md" style="padding-top:0;">
                    @((MarkupString)HtmlContent)
                </Scroll>
            </BodyTemplate>
        </Card>
    </div>
</div>

@code {
    [Inject]
    private HttpClient HttpClient { get; set; }

    string HtmlContent;

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        // 读取 Markdown 文件内容
        string markdownContent = await HttpClient.GetStringAsync("https://easyadmim.wang-zhan.com.cn/doc/更新日志.md");

        // 将 Markdown 转换为 HTML
        var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
        HtmlContent = Markdown.ToHtml(markdownContent, pipeline);
    }
}
